<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.jqGrid.cz.audit"/><spring:message code="message.jqGrid.cz.xiangQing"/> <spring:message code="message.jieSuan.zhongXing"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.jqGrid.cz.audit"/><spring:message code="message.jqGrid.cz.xiangQing"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.jieSuan.guanLi"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.listForm.yiLiaoJiGou"/><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.jieSuan.guanLi"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.listForm.yiLiaoJiGou"/><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.jqGrid.cz.audit"/></a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success ">
            <form  class="form-horizontal" id="form"  method="post" >
            	<div class="box-body">
                    <div class="form-group form-group-xs">
                        <label for="techPos" class="col-sm-2 text-right"><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.yanZheng.bianMa"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
                            ${info.settlementCode}
                        </div>
                        <label for="techPosCertNo" class="col-sm-2 text-right"><spring:message code="message.jieSuan.jieSuanDan"/><spring:message code="message.listForm.mingCheng"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
			              	 ${info.settlementName}
                        </div>
                    </div> 
                    
                    <div class="form-group form-group-xs">
                    	<label for="position" class="col-sm-2 text-right"><spring:message code="message.jieSuan.zongTiaoMuShu"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
	                 		${info.totalOrders}
                        </div>
                        <label for="industry" class="col-sm-2 text-right"><spring:message code="message.jieSuan.zongJinE"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
                         ${info.totalAmount}
                        </div>
                    </div>
                            <div class="form-group form-group-xs">
                    	<label for="position" class="col-sm-2 text-right"><spring:message code="message.jieSuan.chuangJianShiJian"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
	                 		   ${info.createDatetime}
                        </div>
                        <label for="industry" class="col-sm-2 text-right"><spring:message code="message.jieSuan.chuangJianRen"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
                           ${info.createUser}
                        </div>
                    </div>
                 
                    <div class="form-group form-group-xs">
                        <label for="remark" class="col-sm-2 text-right"><spring:message code="message.lable.remark"/><spring:message code="message.yanZheng.maoHao"/></label>
                        <div class="col-sm-4 text-left">
                            ${info.remarks}
                        </div>
                    </div>
                    <div class="form-group form-group-xs">
	                     <label for="name" class="col-sm-2 text-right"><spring:message code="message.listForm.shenHeBeiZhu"/><spring:message code="message.yanZheng.maoHao"/></label>
	                         <div class="col-sm-10">
	                            <textarea class="form-control" rows="3" id="auditRemark"  name="auditRemark"  placeholder="<spring:message code="message.listForm.shenHeBeiZhu"/>" ></textarea>
	                        </div>
	                    </div>
                </div>
                <table class="jqgrid" id="gridlist"></table>
                <div class="box-footer text-center">
                    <button type="button" class="btn btn-success btn-sm"  id="pass" ><spring:message code="message.listForm.tongGuoSpacing"/></button>
                    <button type="button" class="btn btn-success btn-sm" id="notPass" ><spring:message code="message.listForm.buTongGuo"/></button>
                    <a href="toCeterAuditFirstOneList.html" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
                </div>
            </form>
        </div>
    </section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    function validate() {
   		var auditRemark = $.trim($("#auditRemark").val());
		if(auditRemark.length>512){
			$.HN.message.alert("<spring:message code="message.listForm.shenHeBeiZhu"/><spring:message code="message.info.zuiDaChangDu"/>512<spring:message code="message.info.geZiFu"/>！", "<spring:message code="message.HN.alert.type"/>", "warn");
			return false;
		}
		return true;
	}
    $(function(){
    	$('#pass').click(function(){
    		if (!validate()) {return;}
			 $.HN.message.confirm('<spring:message code="message.jieSuan.queDingTongGuoAudit"/>', '', '').on(function (e) {
                if (e) {
               	  $.post('${ctx}/settlementFirst/cetnerAuditFirstOne.html', {"settlementId": "${info.settlementId}","status":"2"},
               		function (result) {
	               			if (result.success) {
	           					$.HN.message.alert("<spring:message code="message.HN.alert.success"/>", "<spring:message code="message.HN.alert.type"/>", "success", function() {
	           						document.location = "${ctx}/settlementFirst/toCeterAuditFirstOneList.html";
	           					});
	           				} else {
	           					$.HN.message.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "<spring:message code="message.HN.alert.type"/>", "error");
	           				}
              			}, "json");
                }
   	     });
       });
   	$('#notPass').click(function(){
   		if (!validate()) {return;}
			 $.HN.message.confirm('<spring:message code="message.jieSuan.queDingBuTongGuoAudit"/>', '', '').on(function (e) {
               if (e) {
                $.post('${ctx}/settlementFirst/cetnerAuditFirstOne.html', {"settlementId": "${info.settlementId}","status":"3"}, 
               		 function (result) {
		         			if (result.success) {
		    					$.HN.message.alert("<spring:message code="message.HN.alert.success"/>", "<spring:message code="message.HN.alert.type"/>", "success", function() {
		    						document.location = "${ctx}/settlementFirst/toCeterAuditFirstOneList.html";
		    					});
		    				} else {
		    					$.HN.message.alert(result.msg || "<spring:message code="message.HN.alert.fail"/>", "<spring:message code="message.HN.alert.type"/>", "error");
		    				}
       		}, "json");
               }
  	     });
      });
    	
    	
    	
		$("#gridlist").jqGrid({   
					url : "${ctx}/settlementFirst/getSetSettlementFirstDetailDataList.html?settlementId=${info.settlementId}",
					mtype : "POST",
					datatype : "json",
					//autowidth : true,
					height : 270,
					colNames:[ 
					           '<spring:message code="message.jieSuan.jieSuanDan"/>ID',
					           '<spring:message code="message.jieSuan.jieSuanDanMingXi"/>ID',
					           '<spring:message code="message.jieSuan.chuangJianRen"/>',
					           '<spring:message code="message.jieSuan.chuangJianShiJian"/>',
					           '<spring:message code="message.jieSuan.zhiFuMingXi"/><spring:message code="message.lable.userType"/>',
					           '<spring:message code="message.model.peiSongQiYe"/>ID',
					           '<spring:message code="message.model.peiSongQiYe"/>',
					           '<spring:message code="message.listForm.yaoPinBianMa"/>',
		                        '<spring:message code="message.listForm.tongYongMing"/>',
					           '<spring:message code="message.listForm.jiXing"/>',
					           '<spring:message code="message.listForm.guiGe"/>',
					           '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
					           '<spring:message code="message.listForm.baoZhuangDanWei"/>',
					           '<spring:message code="message.listForm.caiZhi"/>',
					           '<spring:message code="message.listForm.shengChanQiYe"/>',
					           '<spring:message code="message.jieSuan.caiGouJia"/>',
					           '<spring:message code="message.jieSuan.daoHuoShuLiang"/>'
					           ],
	    		   	colModel:[
						{ name: 'settlementId', width:160,hidden:true,align:"center" ,sortable:false},
						{ name: 'settlementDetailId', width:160,hidden:true,align:"center" ,sortable:false},
						{ name: 'createUser', width:160,hidden:true,align:"center" ,sortable:false},  
						{ name: 'createDatetime', width:160,hidden:true,align:"center" ,sortable:false},   
						{ name: 'bankAcctTransType', width:160,align:"center" ,sortable:false},   
						{ name: 'delCompId', width:160,hidden:true,align:"center" ,sortable:false},       
						{ name: 'delCompName', width:160,align:"center" ,sortable:false},      
	    				{ name: 'drugCode', width:100,align:"center" ,sortable:false},
	    				{ name: 'drugName', width:100, align:"center",sortable:false},
	    				{ name: 'formName', width:80, align:"center",sortable:false},
	    				{ name: 'specName', width:80, align:"center",sortable:false},
	    				{ name: 'factor', width:80, align:"center",sortable:false},
	    				{ name: 'unit', width:80, align:"center",sortable:false},
	    				{ name: 'materialName', width:100, align:"center",sortable:false},
	    				{ name: 'compName', width:150, align:"center",sortable:false},
	    				{ name: 'proPrice', width:100, align:"center",sortable:false,
                     	   formatter:function(cellvalue, options, row){
                               return formatAmount(cellvalue, options, row);
                           }},
	    				{ name: 'recpCount', width:100, align:"center",sortable:false}
	    				
	    		   	],
								
					rownumbers : true,
					pager : "#gridpage",
					viewrecords : true,
					caption : "<spring:message code="message.jqGrid.cz.audit"/><spring:message code="message.jqGrid.cz.xiangQing"/><spring:message code="message.listForm.lieBiao"/>",
					//序号宽度自动变化
	                gridComplete:function(){
	                    //序号列宽度自适应（参数为jqgridID）
	                    autoRNWidth("gridlist");
	                    //数据只有一条时默认选中（参数为jqgridID）
	                    selectByOneData("gridlist");
	                },
					jsonReader : {
						repeatitems : false,
						id : "ids"
					}
				});
		
		
		$("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
		$(window).trigger("resize");
    });
    function CurentTime(now)  
	{       	         
	    var year = now.getFullYear();   
	    var month = now.getMonth() + 1; 
	    var day = now.getDate();     
	         
	    var hh = now.getHours();       
	    var mm = now.getMinutes(); 
	    var ss=now.getSeconds(); 
	    var clock = year + "-"; 
	    if(month < 10) clock += "0";         
	    clock += month + "-";  
	    if(day < 10) clock += "0";   
	    clock += day + " "; 		
	    return(clock);   
	}
 </script>
</body>
</html>